package com.link.base.base.crowd.dao.mybatis.mapper;

import com.link.base.base.crowd.model.CrowdAcct;
import com.link.base.wechat.wxplatform.model.WxPlatform;
import com.link.core.basic.dao.mapper.BasicMapper;

import java.util.List;

/**
 * 人群-消费者中间表
 * @author 何启谦
 * @date 2019-02-21
 */
public interface CrowdAcctMapper extends BasicMapper<CrowdAcct> {

    /**
     * 人群包id + appid + openid不等于null查询记录
     *
     * @author lujiang
     * @date 2019-05-24
     * @param crowdAcct
     * @return
     * @throws Exception
     */
    List<CrowdAcct> queryByCount(CrowdAcct crowdAcct) throws Exception;

    /**
     * @Description //根据人群id消费者手机号码
     * @Param [crowdAcct]人群消费者对象
     * @return 手机号码列表
     * @Author zhiqiang.jiang
     * @Date    2019/5/30-14:10
     */
    public List<String> queryAccntPhone(CrowdAcct crowdAcct) throws Exception;

    /**
     * @Description //根据人群id查询消费者openid
     * @Param [crowdAcct]人群消费者对象
     * @return openId列表
     * @Author zhiqiang.jiang
     * @Date    2019/5/30-14:11
     */
    public List<String> queryAccntOpenId(CrowdAcct crowdAcct) throws Exception;

    /**
     * 查询所有人群包下公众号以及有效粉丝数量
     *
     * @author lujiang
     * @date 2019-05-29
     * @param entity
     * @return
     * @throws Exception
     */
    List<WxPlatform> queryWxPlatformByCrowdId(CrowdAcct entity) throws Exception;

    /**
     * 查询人群包下有效fans数量
     *
     * @author lujiang
     * @date 2019-05-29
     * @param entity
     * @return
     * @throws Exception
     */
    int queryCount(CrowdAcct entity) throws Exception;

    /**
     * 查询有效粉丝总量
     *
     * @author zhaohuanling
     * @date 2019-09-09
     * @param entity
     * @return
     * @throws Exception
     */
    List<CrowdAcct> querySumCount(CrowdAcct entity) throws Exception;

    /**
     * 根据 crowdId 查询 lnk_crowd_acct 中所有记录的RowId和ACCNT_ID
     *
     * @author zhangyuhao
     * @date 2019/06/01 15:41
     * @param entity entity.crowdId
     */
    List<CrowdAcct> queryAllAccountByCrowdId(CrowdAcct entity) throws Exception;

    void batchInsertAcct(List<CrowdAcct> crowdAcctList) throws Exception;

    /**
     * 根据人群圈选包id 查询A类用户数量(单选OpenIdFlag)
     *
     * @author zhangyuhao
     * @date 2019/06/13 14:07
     * @param entity
     */
    Integer queryCountByCrowdIdForOpenId(CrowdAcct entity) throws Exception;

    /**
     * 根据人群圈选包id 查询A类用户数量(单选PhoneFlag)
     *
     * @author zhangyuhao
     * @date 2019/06/13 14:08
     * @param entity
     */
    Integer queryCountByCrowdIdForPhone(CrowdAcct entity) throws Exception;

    /**
     * 根据人群圈选包id 查询A类用户数量(全选 OpenIdFlag && PhoneFlag)
     *
     * @author zhangyuhao
     * @date 2019/06/13 14:08
     * @param entity
     */
    Integer queryCountByCrowdIdForOpenIdAndPhone(CrowdAcct entity) throws Exception;

    /**
     * 查询openids
     *
     * @author lujiang
     * @date 2019-08-26
     * @param crowdAcct
     * @return
     * @throws Exception
     */
    List<CrowdAcct> queryOpenids(CrowdAcct crowdAcct) throws Exception;

    /**
     * 查询数量
     *
     * @author lujiang
     * @date 2019-08-28
     * @param entity
     * @return
     * @throws Exception
     */
    Integer queryOpenidCount(CrowdAcct entity) throws Exception;

    /**
     * 查询appid
     *
     * @author lujiang
     * @date 2019-08-28
     * @param crowdAcct
     * @return
     * @throws Exception
     */
    List<CrowdAcct> queryAppid(CrowdAcct crowdAcct) throws Exception;
}
